package pers.wensheng.patterns.creator_pattern.builder_pattern.common_usage.builder;

import pers.wensheng.patterns.creator_pattern.builder_pattern.common_usage.entity.Bike;


/**
 * 抽象的构建者，父类
 */
public abstract class Builder {
    /**
     * 声名 Bike 类型的变量并进行赋值，子类可以正常的使用
     */
    protected Bike bike = new Bike();

    /**
     * 构建车架
     */
    public abstract void buildFrame();

    /**
     *  构建车座
     */
    public abstract void buildSeat();

    /**
     * 构建自行车的方法
     * @return
     */
    public abstract Bike createBike();

    public Bike construct() {
        this.buildFrame();
        this.buildSeat();
        return this.createBike();
    }
}
